<!-- 
展示屏幕文字滚动效果
 
使用方法：
 -->
<!-- 
展示屏幕文字滚动效果
usage:
 list:数组数据
 @getCurrentIndex  获取当前swiper的下标
 <textscroll :list="list" @getCurrentIndex="getIndex"/>
 -->

<template>
	<view :class="['_notice', {warn: themeCheck=='warn'}]">
		<view class="iconfont icon-laba"></view>
		<swiper class="_swiper tc" @change="slideChange" indicator-dots="false" autoplay="true" :interval="interval" circular="true"
		 display-multiple-items="2" :duration="duration">
			<swiper-item>
				<view class="swiper-item"></view>
			</swiper-item>
			<swiper-item>
				<view class="swiper-item"></view>
			</swiper-item>
			<swiper-item v-for="(item,index) in list" :key="index">
				<view class="swiper-item">{{item}}</view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		props: {
			//显示数据
			list: {
				type: Array,
				defual:function(){
					return [];
				}
			},
			themeCheck: {
				type: String,
				default: 'normal'
			}
		},
		data() {
			return {
				interval:3000,
				duration:12000,
			};
		},
		methods:{
			slideChange(e){
				this.$emit('getCurrentIndex',e.detail.current); 
				
			}
		}
	};
</script>

<style lang="scss" scoped>
	._notice {
		position: relative;
		padding: 0 16rpx 0 50rpx;
		margin: 15rpx auto 0;
		width: calc(100vw - 84rpx);
		height: 60rpx;
		background: linear-gradient(90deg, #BFFCF2 0%, rgba(168, 242, 230, 0.56) 54%, rgba(108, 209, 193, 0.15) 100%);
		box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.16);
		opacity: 0.8;
		border-radius: 20rpx;
		font-size: 24rpx;
		color: #7e7e7e;
		overflow: hidden;
		box-sizing: border-box;
		.icon-laba {
			position: absolute;
			top: 50%;
			left: 14rpx;
			transform: translateY(-50%);
			font-size: 30rpx;
			color: #7e7e7e;
		}
		&.warn {
			background: #fff;
			border: 1rpx solid #f00
		}
	}
	._swiper {
		padding-top: 4rpx;
		line-height: 60rpx;
	}
</style>